package com.huang.ioclifecycle;

import com.huang.entity.User;
import com.huang.service.HelloService;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.stereotype.Component;


public class MyInstantiationAwareBeanPostProcessor implements InstantiationAwareBeanPostProcessor {


	@Override
	public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException {
		if(beanClass == User.class){
			User user = new User();
			user.setName("i am created by postProcessBeforeInstantiation");
			return user;
		}
		return  null;
	}
}
